import { defineStore } from "pinia";
import type {UserType} from '@/types/user'
import {ref} from 'vue'
export const useUserStore = defineStore('cp-user',()=>{
  //定义响应式数据
  const user = ref<UserType>()
  //保存用户信息
   const setStore =(u:UserType)=>{
        user.value =u
   }
  //清空用户信息
   const delStore =()=>{
    user.value =undefined
   }
  return {
    user,
    setStore,
    delStore 
  }
},
{
  persist:true
}
)